Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support __cuda_array_interface__ types without len() #89

Closed

Conversation

pentschev
Copy link
Member

Support __cuda_array_interface__ types that do not implement the __len__ method. The distributed.utils.nbytes function that we currently use relies on determining the size of object using either the __len__ methods implemented by the type or the nbytes attribute, which are not required by types that implement __cuda_array_interface__, such as pylibcudf.gpumemoryview. This change attempts to use the existing distributed.utils.nbytes function, and if that does not succeed then proceeds to calculate the size based on the attributes of __cuda_array_interface__. Note that strides are not currently implemented.

@pentschev pentschev requested a review from a team as a code owner February 27, 2025 21:48
@pentschev pentschev added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Feb 27, 2025
Copy link
Member

@rjzamora rjzamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pentschev !

I'm eager to get this in, so I don't want to make you jump through any unnecessary hoops. With that said, I have one suggestion: Can we add a comment explaining why we are adding this patch? Ideally, the comment would explain what a "long-term" fix would look like (do we know what that looks like?)

@pentschev
Copy link
Member Author

Ideally, the comment would explain what a "long-term" fix would look like (do we know what that looks like?)

Actually, maybe we'll be better off implementing __len__/nbytes for gpumemoryview. Let me give that a look tomorrow to evaluate how much work that would be, in trying to move fast I forgot to look at that.

@pentschev
Copy link
Member Author

Superseded by rapidsai/cudf#18133 , closing.

@pentschev pentschev closed this Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants